<?php
   header("content-type:text/html;charset=utf8");
   $conn=new Mysqli("localhost","root","root","db_bailian");
   Mysqli_set_charset($conn,'utf8');
   if($conn->connect_errno){
       die("数据库连接失败！");
   };
   $username=$_POST["username"];
   $password=$_POST["password"];
   $phone=$_POST["phone"];
   $email=$_POST["email"];
   
    $sql="select * from t_user where username='{$username}'";
    $res=$conn->query($sql);
    if(Mysqli_num_rows($res)>0){
    echo false;
    }else if($username && $password && $phone){
    $sql="insert into t_user (username,password,phone,email) values ('{$username}','{$password}','{$phone}','{$email}')";
    $res=$conn->query($sql);
    if($res){
    echo true;
    }
    };
?>
  